package com.seaboxdata.utils;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 时间工具类
 *
 * @Author wei
 * @Date 2021/8/5 15:28
 **/
public class DateUtil {

    private static final String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";

    public static Date now() throws Exception {
        return now(YYYY_MM_DD_HH_MM_SS, now(YYYY_MM_DD_HH_MM_SS, new Date()));
    }


    public static Date now(String format, String date) throws Exception {
        return new SimpleDateFormat(format).parse(date);
    }

    public static String now(String format, Date date) throws Exception {
        return new SimpleDateFormat(format).format(date);
    }
}
